﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Common;
using Services;
using EntityModel;
using ShopWeb;

namespace Heart.Controllers
{
    public class MemberController : Controller
    {
        MemberService memberService = new MemberService();

        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Register()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Register(FormCollection f)
        {
            string email = WebBase.GetForm("Email");
            string password = WebBase.Encode( WebBase.GetForm("Password"));
            memberService.Register(email,password);
            return RedirectToAction("index", "admin");
        }
        public ActionResult GetValidateCode()
        {
            ValidateCode vCode = new ValidateCode();
            string code = vCode.CreateValidateCode(4);
            Session["ValidateCode"] = code;
            byte[] bytes = vCode.CreateValidateGraphic(code);
            return File(bytes, @"image/gif");
        }

        public ActionResult Login()
        {

            return View();
        }



    }
}
